package com.linkage.educloud.ah.mvp.contract;


import com.linkage.educloud.ah.bean.AccountData;
import com.linkage.educloud.ah.mvp.ABasicPresenter;
import com.linkage.educloud.ah.mvp.IBasicView;
import com.linkage.educloud.ah.mvp.ICommonModel;

import java.util.List;

import io.reactivex.Observable;

/**
 * <desc>
 * Created by The Moss on 2018/7/26.
 */

public interface ILoginContract {
    interface IView extends IBasicView {
        /*登录*/
        void onLoginResult(boolean isSuccess, Object t);
        /*验证账号结果*/
        void onValidateResult(boolean isSuccess, Object t);
        /*获取最近一次登录的用户*/
        void getLastLoginAccount(AccountData accountData);
        /*最近登录的3条记录*/
        void getLastLoginAccounts(List<AccountData> accounts);
        /*根据用户输入账号检索本地用户信息*/
        void getAccountByInput(AccountData accountData);
        /*获取登录验证码结果*/
        void onSendSmsCodeResult(boolean isSuccess);
    }

    abstract class IPresenter<T extends IBasicView> extends ABasicPresenter {
        public IPresenter(T iView) {
            super(iView);
        }

        /*验证账号*/
        public abstract void validateAccount(String account);
        /*登录*/
        public abstract void login(String account, String passint, int loginType);
        /*获取最近登录的用户*/
        public abstract void getLastLoginAccounts();
        /*根据用户输入账号查询本地数据是否存在*/
        public abstract void valudateAccountLocal(String input);
        /*发送验证码*/
        public abstract void sendSmsCode(String account);
    }

    interface IModel extends ICommonModel {
        Observable lastLoginAccount();
    }
}
